package MIPS;

public class CalRI extends Mips {
    private String cal_ans;
    private String cal_a;
    private String cal_b;
    private int type;       //0：R 1：I 2:sw/lw  3：branch

    public CalRI(Operate op, String cal_ans, String cal_a, String cal_b, int type) {
        super(op);
        this.cal_ans = cal_ans;
        this.cal_a = cal_a;
        this.cal_b = cal_b;
        this.type = type;
    }

    public String toString() {
        if (type == 2) {
            return opToString() + " " + cal_ans + " " + cal_a + "(" + cal_b + ")\n";
        } else {
            return opToString() + " " + cal_ans + " " + cal_a + " " + cal_b + "\n";
        }
    }
}
